Video signal processing method and device for intra prediction of coding or prediction blocks based on sample position based parameters

ABSTRACT

The present invention is related to processing a video signal. A method for decoding a video according to the present invention may comprise generating a prediction block of a current block by performing intra prediction, deriving at least one sample position based parameter based on a position of a first prediction sample in the prediction block, and obtaining a second prediction sample by weighted predicting the first prediction sample based on the at least one sample position based parameter. According to the present invention, encoding/decoding efficiency of a video signal can be improved since intra prediction is performed more accurately.

TECHNICAL FIELD

The present invention relates to a method and an apparatus forprocessing video signal.

BACKGROUND ART

Recently, demands for high-resolution and high-quality images such ashigh definition (HD) images and ultra-high definition (UHD) images haveincreased in various application fields. However, higher resolution andquality image data has increasing amounts of data in comparison withconventional image data. Therefore, when transmitting image data byusing a medium such as conventional wired and wireless broadbandnetworks, or when storing image data by using a conventional storagemedium, costs of transmitting and storing increase. In order to solvethese problems occurring with an increase in resolution and quality ofimage data, high-efficiency image encoding/decoding techniques may beutilized.

Image compression technology includes various techniques, including: aninter-prediction technique of predicting a pixel value included in acurrent picture from a previous or subsequent picture of the currentpicture; an intra-prediction technique of predicting a pixel valueincluded in a current picture by using pixel information in the currentpicture; an entropy encoding technique of assigning a short code to avalue with a high appearance frequency and assigning a long code to avalue with a low appearance frequency; etc. Image data may beeffectively compressed by using such image compression technology, andmay be transmitted or stored.

In the meantime, with demands for high-resolution images, demands forstereographic image content, which is a new image service, have alsoincreased. A video compression technique for effectively providingstereographic image content with high resolution and ultra-highresolution is being discussed.

DISCLOSURE Technical Problem

An object of the present invention is to provide a method and anapparatus for multi-tree partitioning which can be used efficientlypartitioning an encoding/decoding target block in encoding/decoding avideo signal.

An object of the present invention is to provide a method and anapparatus for intra prediction of a coding block or a prediction blockwhich is partitioned by multi-tree partitioning.

An object of the present invention is to provide a recoding mediumincluding a video signal bitstream encoded by the encoding method.

The technical objects to be achieved by the present invention are notlimited to the above-mentioned technical problems. And, other technicalproblems that are not mentioned will be apparently understood to thoseskilled in the art from the following description.

Technical Solution

A method for decoding a video signal according to the present inventionmay comprise generating a prediction block of a current block byperforming intra prediction, deriving at least one sample position basedparameter based on a position of a first prediction sample in theprediction block, and obtaining a second prediction sample by weightedpredicting the first prediction sample based on the at least one sampleposition based parameter.

In addition, the at least one sample position based parameter may bederived based on at least one of a distance between a base referencesample and a corresponding reference sample which corresponds to acurrent sample, a difference between a value of the base referencesample and a value of the corresponding reference sample, a size of thecurrent block and a shape of the current block.

In addition, the base reference sample may be a reference sample of apredetermined position among reference samples used for intra predictionof the current block.

In addition, the corresponding reference sample may be a referencesample which is located on a same x-axis or a same y-axis as the firstprediction sample among reference samples used for intra prediction ofthe current block.

In addition, obtaining the second prediction sample may comprisederiving a weight calculated value by applying the at least one sampleposition based parameter to a value of the first prediction sample, andobtaining the second prediction sample by scaling the weight calculatedvalue by using a weight prediction shift parameter and a weightprediction offset.

In addition, the weight prediction shift parameter or the weightprediction offset may be derived based on a width of a height of thecurrent block.

A method for encoding a video signal according to the present inventionmay comprise generating a prediction block of a current block byperforming intra prediction, deriving at least one sample position basedparameter based on a position of a first prediction sample in theprediction block, and obtaining a second prediction sample by weightedpredicting the first prediction sample based on the at least one sampleposition based parameter.

An apparatus for decoding a video signal according to the presentinvention may comprise an inverse quantization unit to generate aninverse quantized coefficient value by inverse quantizing a coefficientvalue of a residual block extracted from a bitstream, an inversetransform unit to generate a residual sample value of a current block byinverse transforming the inverse quantized coefficient value, and anintra prediction unit to generate a prediction block of the currentblock by performing intra prediction. The intra prediction unit mayderive at least one sample position based parameter based on a firstprediction sample in the prediction block, and obtains a secondprediction sample by weighted predicting the first prediction samplebased on the at least one sample position based parameter.

A recoding medium comprising a video signal bitstream according to thepresent invention, the video signal bitstream included in the recodingmedium may be encoded by a video encoding method comprising generating aprediction block of a current block by performing intra prediction,deriving at least one sample position based parameter based on aposition of a first prediction sample in the prediction block, andobtaining a second prediction sample by weighted predicting the firstprediction sample based on the at least one sample position basedparameter.

The features briefly summarized above for the present invention are onlyillustrative aspects of the detailed description of the invention thatfollows, but do not limit the scope of the invention.

Advantageous Effects

According to the present invention, encoding/decoding efficiency ofvideo signal is improved by partitioning an encoding/decoding targetblock efficiently.

According to the present invention, encoding/decoding efficiency ofvideo signal is enhanced by improving an accuracy of intra prediction bygenerating a modified prediction sample value, from an intra predictedsample value firstly obtained by intra prediction, based on a sampleposition based parameter.

The effects obtainable by the present invention are not limited to theabove-mentioned effects, and other effects not mentioned can be clearlyunderstood by those skilled in the art from the description below.

DESCRIPTION OF DRAWINGS

FIG. 1 is a block diagram illustrating a device for encoding a videoaccording to an embodiment of the present invention.

FIG. 2 is a block diagram illustrating a device for decoding a videoaccording to an embodiment of the present invention.

FIGS. 3A and 3B are diagram illustrating a partition mode that can beapplied to a coding block.

FIGS. 4A to 4C are diagram illustrating a partition type in which a quadtree and a binary tree partitioning are allowed according to anembodiment of the present invention.

FIG. 5 illustrates an example in which a coding block is hierarchicallydivided based on quad tree partitioning and binary tree partitioning,according to an embodiment to which the present invention is applied.

FIGS. 6A to 6C illustrates an example in which a coding block ishierarchically divided based on quad tree partitioning and symmetricbinary tree partitioning, according to an embodiment to which thepresent invention is applied.

FIGS. 7A to 7I are diagram illustrating a partition type in whichmulti-tree partitioning is allowed according to another embodiment ofthe present invention.

FIG. 8 is a diagram illustrating types of pre-defined intra predictionmodes for a device for encoding/decoding a video according to anembodiment of the present invention.

FIG. 9 is a diagram illustrating a kind of extended intra predictionmodes at an encoder/decoder according to an embodiment of the presentinvention.

FIG. 10 is a flowchart briefly illustrating an intra prediction methodaccording to an embodiment of the present invention.

FIG. 11 is a flowchart illustrating an intra prediction method using asample position based parameter according to an embodiment to which thepresent invention is applied.

FIG. 12 illustrates a base reference sample and a correspondingreference sample according to an embodiment of the present invention.

MODE FOR INVENTION

A variety of modifications may be made to the present invention andthere are various embodiments of the present invention, examples ofwhich will now be provided with reference to drawings and described indetail. However, the present invention is not limited thereto, and theexemplary embodiments can be construed as including all modifications,equivalents, or substitutes in a technical concept and a technical scopeof the present invention. The similar reference numerals refer to thesimilar element in described the drawings.

Terms used in the specification, ‘first’, ‘second’, etc. can be used todescribe various components, but the components are not to be construedas being limited to the terms. The terms are only used to differentiateone component from other components. For example, the ‘first’ componentmay be named the ‘second’ component without departing from the scope ofthe present invention, and the ‘second’ component may also be similarlynamed the ‘first’ component. The term ‘and/or’ includes a combination ofa plurality of items or any one of a plurality of terms.

The terms used in the present specification are merely used to describeparticular embodiments, and are not intended to limit the presentinvention. An expression used in the singular encompasses the expressionof the plural, unless it has a clearly different meaning in the context.In the present specification, it is to be understood that terms such as“including”, “having”, etc. are intended to indicate the existence ofthe features, numbers, steps, actions, elements, parts, or combinationsthereof disclosed in the specification, and are not intended to precludethe possibility that one or more other features, numbers, steps,actions, elements, parts, or combinations thereof may exist or may beadded.

In addition, a term “unit” used in the present application may bereplaced by a “block”, and thus, in the present specification, each termin a pair of “coding tree unit” and “coding tree block”, “coding unit”and “coding block”, “prediction unit” and “prediction block”, and“transform unit” and “transform block” may be interpreted to have thesame meaning.

Hereinafter, preferred embodiments of the present invention will bedescribed in detail with reference to the accompanying drawings.Hereinafter, the same constituent elements in the drawings are denotedby the same reference numerals, and a repeated description of the sameelements will be omitted.

FIG. 1 is a block diagram illustrating a device for encoding a videoaccording to an embodiment of the present invention.

Referring to FIG. 1, the device 100 for encoding a video may include: apicture partitioning module 110, prediction modules 120 and 125, atransform module 130, a quantization module 135, a rearrangement module160, an entropy encoding module 165, an inverse quantization module 140,an inverse transform module 145, a filter module 150, and a memory 155.

The constitutional parts shown in FIG. 1 are independently shown so asto represent characteristic functions different from each other in thedevice for encoding a video. Thus, it does not mean that eachconstitutional part is constituted in a constitutional unit of separatedhardware or software. In other words, each constitutional part includeseach of enumerated constitutional parts for convenience. Thus, at leasttwo constitutional parts of each constitutional part may be combined toform one constitutional part or one constitutional part may be dividedinto a plurality of constitutional parts to perform each function. Theembodiment where each constitutional part is combined and the embodimentwhere one constitutional part is divided are also included in the scopeof the present invention, if not departing from the essence of thepresent invention.

Also, some of constituents may not be indispensable constituentsperforming essential functions of the present invention but be selectiveconstituents improving only performance thereof. The present inventionmay be implemented by including only the indispensable constitutionalparts for implementing the essence of the present invention except theconstituents used in improving performance. The structure including onlythe indispensable constituents except the selective constituents used inimproving only performance is also included in the scope of the presentinvention.

The picture partitioning module 110 may partition an input picture intoone or more processing units. Here, the processing unit may be aprediction unit (PU), a transform unit (TU), or a coding unit (CU). Thepicture partitioning module 110 may partition one picture intocombinations of multiple coding units, prediction units, and transformunits, and may encode a picture by selecting one combination of codingunits, prediction units, and transform units with a predeterminedcriterion (e.g., cost function).

For example, one picture may be partitioned into multiple coding units.A recursive tree structure, such as a quad tree structure, may be usedto partition a picture into coding units. A coding unit which ispartitioned into other coding units with one picture or a largest codingunit as a root may be partitioned with child nodes corresponding to thenumber of partitioned coding units. A coding unit which is no longerpartitioned by a predetermined limitation serves as a leaf node. Thatis, when it is assumed that only square partitioning is possible for onecoding unit, one coding unit may be partitioned into four other codingunits at most.

Hereinafter, in the embodiment of the present invention, the coding unitmay mean a unit performing encoding, or a unit performing decoding.

A prediction unit may be one of partitions partitioned into a square ora rectangular shape having the same size in a single coding unit, or aprediction unit may be one of partitions partitioned so as to have adifferent shape/size in a single coding unit.

When a prediction unit subjected to intra prediction is generated basedon a coding unit and the coding unit is not the smallest coding unit,intra prediction may be performed without partitioning the coding unitinto multiple prediction units N×N.

The prediction modules 120 and 125 may include an inter predictionmodule 120 performing inter prediction and an intra prediction module125 performing intra prediction. Whether to perform inter prediction orintra prediction for the prediction unit may be determined, and detailedinformation (e.g., an intra prediction mode, a motion vector, areference picture, etc.) according to each prediction method may bedetermined. Here, the processing unit subjected to prediction may bedifferent from the processing unit for which the prediction method anddetailed content is determined. For example, the prediction method, theprediction mode, etc. may be determined by the prediction unit, andprediction may be performed by the transform unit. A residual value(residual block) between the generated prediction block and an originalblock may be input to the transform module 130. Also, prediction modeinformation, motion vector information, etc. used for prediction may beencoded with the residual value by the entropy encoding module 165 andmay be transmitted to a device for decoding a video. When a particularencoding mode is used, it is possible to transmit to a device fordecoding video by encoding the original block as it is withoutgenerating the prediction block through the prediction modules 120 and125.

The inter prediction module 120 may predict the prediction unit based oninformation of at least one of a previous picture or a subsequentpicture of the current picture, or may predict the prediction unit basedon information of some encoded regions in the current picture, in somecases. The inter prediction module 120 may include a reference pictureinterpolation module, a motion prediction module, and a motioncompensation module.

The reference picture interpolation module may receive reference pictureinformation from the memory 155 and may generate pixel information of aninteger pixel or less then the integer pixel from the reference picture.In the case of luma pixels, an 8-tap DCT-based interpolation filterhaving different filter coefficients may be used to generate pixelinformation of an integer pixel or less than an integer pixel in unitsof a ¼ pixel. In the case of chroma signals, a 4-tap DCT-basedinterpolation filter having different filter coefficient may be used togenerate pixel information of an integer pixel or less than an integerpixel in units of a ⅛ pixel.

The motion prediction module may perform motion prediction based on thereference picture interpolated by the reference picture interpolationmodule. As methods for calculating a motion vector, various methods,such as a full search-based block matching algorithm (FBMA), a threestep search (TSS), a new three-step search algorithm (NTS), etc., may beused. The motion vector may have a motion vector value in units of a ½pixel or a ¼ pixel based on an interpolated pixel. The motion predictionmodule may predict a current prediction unit by changing the motionprediction method. As motion prediction methods, various methods, suchas a skip method, a merge method, an AMVP (Advanced Motion VectorPrediction) method, an intra block copy method, etc., may be used.

The intra prediction module 125 may generate a prediction unit based onreference pixel information neighboring to a current block which ispixel information in the current picture. When the neighboring block ofthe current prediction unit is a block subjected to inter prediction andthus a reference pixel is a pixel subjected to inter prediction, thereference pixel included in the block subjected to inter prediction maybe replaced with reference pixel information of a neighboring blocksubjected to intra prediction. That is, when a reference pixel is notavailable, at least one reference pixel of available reference pixelsmay be used instead of unavailable reference pixel information.

Prediction modes in intra prediction may include a directionalprediction mode using reference pixel information depending on aprediction direction and a non-directional prediction mode not usingdirectional information in performing prediction. A mode for predictingluma information may be different from a mode for predicting chromainformation, and in order to predict the chroma information, intraprediction mode information used to predict luma information orpredicted luma signal information may be utilized.

In performing intra prediction, when the size of the prediction unit isthe same as the size of the transform unit, intra prediction may beperformed on the prediction unit based on pixels positioned at the left,the top left, and the top of the prediction unit. However, in performingintra prediction, when the size of the prediction unit is different fromthe size of the transform unit, intra prediction may be performed usinga reference pixel based on the transform unit. Also, intra predictionusing N×N partitioning may be used for only the smallest coding unit.

In the intra prediction method, a prediction block may be generatedafter applying an AIS (Adaptive Intra Smoothing) filter to a referencepixel depending on the prediction modes. The type of the AIS filterapplied to the reference pixel may vary. In order to perform the intraprediction method, an intra prediction mode of the current predictionunit may be predicted from the intra prediction mode of the predictionunit neighboring to the current prediction unit. In prediction of theprediction mode of the current prediction unit by using mode informationpredicted from the neighboring prediction unit, when the intraprediction mode of the current prediction unit is the same as the intraprediction mode of the neighboring prediction unit, informationindicating that the prediction modes of the current prediction unit andthe neighboring prediction unit are equal to each other may betransmitted using predetermined flag information. When the predictionmode of the current prediction unit is different from the predictionmode of the neighboring prediction unit, entropy encoding may beperformed to encode prediction mode information of the current block.

Also, a residual block including information on a residual value whichis a different between the prediction unit subjected to prediction andthe original block of the prediction unit may be generated based onprediction units generated by the prediction modules 120 and 125. Thegenerated residual block may be input to the transform module 130.

The transform module 130 may transform the residual block including theinformation on the residual value between the original block and theprediction unit generated by the prediction modules 120 and 125 by usinga transform method, such as discrete cosine transform (DCT), discretesine transform (DST), and KLT. Whether to apply DCT, DST, or KLT inorder to transform the residual block may be determined based on intraprediction mode information of the prediction unit used to generate theresidual block.

The quantization module 135 may quantize values transformed to afrequency domain by the transform module 130. Quantization coefficientsmay vary depending on the block or importance of a picture. The valuescalculated by the quantization module 135 may be provided to the inversequantization module 140 and the rearrangement module 160.

The rearrangement module 160 may rearrange coefficients of quantizedresidual values.

The rearrangement module 160 may change a coefficient in the form of atwo-dimensional block into a coefficient in the form of aone-dimensional vector through a coefficient scanning method. Forexample, the rearrangement module 160 may scan from a DC coefficient toa coefficient in a high frequency domain using a zigzag scanning methodso as to change the coefficients to be in the form of one-dimensionalvectors. Depending on the size of the transform unit and the intraprediction mode, vertical direction scanning where coefficients in theform of two-dimensional blocks are scanned in the column direction orhorizontal direction scanning where coefficients in the form oftwo-dimensional blocks are scanned in the row direction may be usedinstead of zigzag scanning. That is, which scanning method among zigzagscanning, vertical direction scanning, and horizontal direction scanningis used may be determined depending on the size of the transform unitand the intra prediction mode.

The entropy encoding module 165 may perform entropy encoding based onthe values calculated by the rearrangement module 160. Entropy encodingmay use various encoding methods, for example, exponential Golombcoding, context-adaptive variable length coding (CAVLC), andcontext-adaptive binary arithmetic coding (CABAC).

The entropy encoding module 165 may encode a variety of information,such as residual value coefficient information and block typeinformation of the coding unit, prediction mode information, partitionunit information, prediction unit information, transform unitinformation, motion vector information, reference frame information,block interpolation information, filtering information, etc. from therearrangement module 160 and the prediction modules 120 and 125.

The entropy encoding module 165 may entropy encode the coefficients ofthe coding unit input from the rearrangement module 160.

The inverse quantization module 140 may inversely quantize the valuesquantized by the quantization module 135 and the inverse transformmodule 145 may inversely transform the values transformed by thetransform module 130. The residual value generated by the inversequantization module 140 and the inverse transform module 145 may becombined with the prediction unit predicted by a motion estimationmodule, a motion compensation module, and the intra prediction module ofthe prediction modules 120 and 125 such that a reconstructed block canbe generated.

The filter module 150 may include at least one of a deblocking filter,an offset correction unit, and an adaptive loop filter (ALF).

The deblocking filter may remove block distortion that occurs due toboundaries between the blocks in the reconstructed picture. In order todetermine whether to perform deblocking, the pixels included in severalrows or columns in the block may be a basis of determining whether toapply the deblocking filter to the current block. When the deblockingfilter is applied to the block, a strong filter or a weak filter may beapplied depending on required deblocking filtering strength. Also, inapplying the deblocking filter, horizontal direction filtering andvertical direction filtering may be processed in parallel.

The offset correction module may correct offset with the originalpicture in units of a pixel in the picture subjected to deblocking. Inorder to perform the offset correction on a particular picture, it ispossible to use a method of applying offset in consideration of edgeinformation of each pixel or a method of partitioning pixels of apicture into the predetermined number of regions, determining a regionto be subjected to perform offset, and applying the offset to thedetermined region.

Adaptive loop filtering (ALF) may be performed based on the valueobtained by comparing the filtered reconstructed picture and theoriginal picture. The pixels included in the picture may be divided intopredetermined groups, a filter to be applied to each of the groups maybe determined, and filtering may be individually performed for eachgroup. Information on whether to apply ALF and a luma signal may betransmitted by coding units (CU). The shape and filter coefficient of afilter for ALF may vary depending on each block. Also, the filter forALF in the same shape (fixed shape) may be applied regardless ofcharacteristics of the application target block.

The memory 155 may store the reconstructed block or picture calculatedthrough the filter module 150. The stored reconstructed block or picturemay be provided to the prediction modules 120 and 125 in performinginter prediction.

FIG. 2 is a block diagram illustrating a device for decoding a videoaccording to an embodiment of the present invention.

Referring to FIG. 2, the device 200 for decoding a video may include: anentropy decoding module 210, a rearrangement module 215, an inversequantization module 220, an inverse transform module 225, predictionmodules 230 and 235, a filter module 240, and a memory 245.

When a video bitstream is input from the device for encoding a video,the input bitstream may be decoded according to an inverse process ofthe device for encoding a video.

The entropy decoding module 210 may perform entropy decoding accordingto an inverse process of entropy encoding by the entropy encoding moduleof the device for encoding a video. For example, corresponding to themethods performed by the device for encoding a video, various methods,such as exponential Golomb coding, context-adaptive variable lengthcoding (CAVLC), and context-adaptive binary arithmetic coding (CABAC)may be applied.

The entropy decoding module 210 may decode information on intraprediction and inter prediction performed by the device for encoding avideo.

The rearrangement module 215 may perform rearrangement on the bitstreamentropy decoded by the entropy decoding module 210 based on therearrangement method used in the device for encoding a video. Therearrangement module may reconstruct and rearrange the coefficients inthe form of one-dimensional vectors to the coefficient in the form oftwo-dimensional blocks. The rearrangement module 215 may receiveinformation related to coefficient scanning performed in the device forencoding a video and may perform rearrangement via a method of inverselyscanning the coefficients based on the scanning order performed in thedevice for encoding a video.

The inverse quantization module 220 may perform inverse quantizationbased on a quantization parameter received from the device for encodinga video and the rearranged coefficients of the block.

The inverse transform module 225 may perform the inverse transform,i.e., inverse DCT, inverse DST, and inverse KLT, which is the inverseprocess of transform, i.e., DCT, DST, and KLT, performed by thetransform module on the quantization result by the device for encoding avideo. Inverse transform may be performed based on a transfer unitdetermined by the device for encoding a video. The inverse transformmodule 225 of the device for decoding a video may selectively performtransform schemes (e.g., DCT, DST, and KLT) depending on multiple piecesof information, such as the prediction method, the size of the currentblock, the prediction direction, etc.

The prediction modules 230 and 235 may generate a prediction block basedon information on prediction block generation received from the entropydecoding module 210 and previously decoded block or picture informationreceived from the memory 245.

As described above, like the operation of the device for encoding avideo, in performing intra prediction, when the size of the predictionunit is the same as the size of the transform unit, intra prediction maybe performed on the prediction unit based on the pixels positioned atthe left, the top left, and the top of the prediction unit. Inperforming intra prediction, when the size of the prediction unit isdifferent from the size of the transform unit, intra prediction may beperformed using a reference pixel based on the transform unit. Also,intra prediction using N×N partitioning may be used for only thesmallest coding unit.

The prediction modules 230 and 235 may include a prediction unitdetermination module, an inter prediction module, and an intraprediction module. The prediction unit determination module may receivea variety of information, such as prediction unit information,prediction mode information of an intra prediction method, informationon motion prediction of an inter prediction method, etc. from theentropy decoding module 210, may divide a current coding unit intoprediction units, and may determine whether inter prediction or intraprediction is performed on the prediction unit. By using informationrequired in inter prediction of the current prediction unit receivedfrom the device for encoding a video, the inter prediction module 230may perform inter prediction on the current prediction unit based oninformation of at least one of a previous picture or a subsequentpicture of the current picture including the current prediction unit.Alternatively, inter prediction may be performed based on information ofsome pre-reconstructed regions in the current picture including thecurrent prediction unit.

In order to perform inter prediction, it may be determined for thecoding unit which of a skip mode, a merge mode, an AMVP mode, and aninter block copy mode is used as the motion prediction method of theprediction unit included in the coding unit.

The intra prediction module 235 may generate a prediction block based onpixel information in the current picture. When the prediction unit is aprediction unit subjected to intra prediction, intra prediction may beperformed based on intra prediction mode information of the predictionunit received from the device for encoding a video. The intra predictionmodule 235 may include an adaptive intra smoothing (AIS) filter, areference pixel interpolation module, and a DC filter. The AIS filterperforms filtering on the reference pixel of the current block, andwhether to apply the filter may be determined depending on theprediction mode of the current prediction unit. AIS filtering may beperformed on the reference pixel of the current block by using theprediction mode of the prediction unit and AIS filter informationreceived from the device for encoding a video. When the prediction modeof the current block is a mode where AIS filtering is not performed, theAIS filter may not be applied.

When the prediction mode of the prediction unit is a prediction mode inwhich intra prediction is performed based on the pixel value obtained byinterpolating the reference pixel, the reference pixel interpolationmodule may interpolate the reference pixel to generate the referencepixel of an integer pixel or less than an integer pixel. When theprediction mode of the current prediction unit is a prediction mode inwhich a prediction block is generated without interpolation thereference pixel, the reference pixel may not be interpolated. The DCfilter may generate a prediction block through filtering when theprediction mode of the current block is a DC mode.

The reconstructed block or picture may be provided to the filter module240. The filter module 240 may include the deblocking filter, the offsetcorrection module, and the ALF.

Information on whether or not the deblocking filter is applied to thecorresponding block or picture and information on which of a strongfilter and a weak filter is applied when the deblocking filter isapplied may be received from the device for encoding a video. Thedeblocking filter of the device for decoding a video may receiveinformation on the deblocking filter from the device for encoding avideo, and may perform deblocking filtering on the corresponding block.

The offset correction module may perform offset correction on thereconstructed picture based on the type of offset correction and offsetvalue information applied to a picture in performing encoding.

The ALF may be applied to the coding unit based on information onwhether to apply the ALF, ALF coefficient information, etc. receivedfrom the device for encoding a video. The ALF information may beprovided as being included in a particular parameter set.

The memory 245 may store the reconstructed picture or block for use as areference picture or block, and may provide the reconstructed picture toan output module.

As described above, in the embodiment of the present invention, forconvenience of explanation, the coding unit is used as a termrepresenting a unit for encoding, but the coding unit may serve as aunit performing decoding as well as encoding.

In addition, a current block may represent a target block to beencoded/decoded. And, the current block may represent a coding treeblock (or a coding tree unit), a coding block (or a coding unit), atransform block (or a transform unit), a prediction block (or aprediction unit), or the like depending on an encoding/decoding step. Inthis specification, a term ‘unit’ may represent a basic unit forperforming a specific encoding/decoding process, and a term ‘block’ mayrepresent sample arrays of a predetermined size. If there is nodistintion between them, the terms ‘block’ and ‘unit’ may be used tohave equivalent meanings. For example, in the embodiments describedbelow, it can be understood that a coding block and a coding unit havemutually equivalent meanings.

A picture may be encoded/decoded by divided into base blocks having asquare shape or a non-square shape. At this time, the base block may bereferred to as a coding tree unit. The coding tree unit may be definedas a coding unit of the largest size allowed within a sequence or aslice. Information regarding whether the coding tree unit has a squareshape or has a non-square shape or information regarding a size of thecoding tree unit may be signaled through a sequence parameter set, apicture parameter set, or a slice header. The coding tree unit may bedivided into smaller size partitions. At this time, if it is assumedthat a depth of a partition generated by dividing the coding tree unitis 1, a depth of a partition generated by dividing the partition havingdepth 1 may be defined as 2. That is, a partition generated by dividinga partition having a depth k in the coding tree unit may be defined ashaving a depth k+1.

FIGS. 3A and 3B are diagram illustrating a partition mode that can beapplied to a coding block when the coding block is encoded by intraprediction or inter prediction. A partition of arbitrary size generatedby dividing a coding tree unit may be defined as a coding unit. Forexample, it is illustrated in FIG. 3A a coding unit of 2N×2N size. Thecoding unit may be recursively divided or divided into base units forperforming prediction, quantization, transform, or in-loop filtering,and the like. For example, a partition of arbitrary size generated bydividing the coding unit may be defined as a coding unit, or may bedefined as a transform unit (TU) or a prediction unit (PU), which is abase unit for performing prediction, quantization, transform or in-loopfiltering and the like.

Alternatively, if a coding block is determined, a prediction blockhaving the same size as the coding block or smaller than the codingblock may be determined through predictive partitioning of the codingblock. Predictive partitioning of the coding block can be performed by apartition mode (Part mode) indicating a partition type of the codingblock. A size or shape of the prediction block may be determinedaccording to the partition mode of the coding block. The partition typeof the coding block may be determined through information specifying anyone of partition candidates. At this time, the partition candidatesavailable to the coding block may include an asymmetric partition type(for example, nLx2N, nRx2N, 2NxnU, 2NxnD) depending on a size, a shape,an encoding mode or the like of the coding block. For example, thepartition candidates available to the coding block may be determinedaccording to the encoding mode of the current block. For example, whenthe coding block is encoded by inter prediction, one of 8 partitionmodes may be applied to the coding block, as in the example shown inFIG. 3B. On the other hand, when the coding block is encoded by intraprediction, PART 2N×2N or PART N×N among the 8 partition modes of FIG.3B may be applied to the coding block.

PART N×N may be applied when the coding block has a minimum size. Here,the minimum size of the coding block may be pre-defined in the encoderand the decoder. Alternatively, information regarding the minimum sizeof the coding block may be signaled via the bitstream. For example, theminimum size of the coding block may be signaled through a slice header,so that the minimum size of the coding block may be defined for eachslice.

In another example, partition candidates available to a coding block maybe determined differently depending on at least one of a size or shapeof the coding block. For example, the number or type of partitioncandidates available to the coding block may be determined differentlyaccording to at least one of the size or shape of the coding block.

Alternatively, the type or number of asymmetric partition candidatesamong the partition candidates available to the coding block may belimited depending on the size or shape of the coding block. For example,the number or type of asymmetric partition candidates available to thecoding block may be differently determined according to at least one ofthe size or shape of the coding block.

In general, a prediction block may have a size from 64×64 to 4×4.However, when a coding block is encoded by inter prediction, it ispossible to prevent the prediction block from having a 4×4 size in orderto reduce a memory bandwidth when performing motion compensation.

It is also possible to recursively divide a coding block using thepartition mode. That is, the coding block may be divided according tothe partition mode indicated by a partition index, and each partitiongenerated by partitioning the coding block may be defined as a codingblock.

Hereinafter, a method of recursively partitioning a coding unit will bedescribed in more detail. For convenience of explanation, it is assumedthat a coding tree unit is also included in a category of a coding unit.That is, in a later-described embodiment, a coding unit may refer to acoding tree unit, or may refer to a coding unit that is generatedresulting from partitioning the coding tree unit. Also, when a codingblock is recursively divided, it can be understood that a ‘partition’generated by partitioning the coding block means a ‘coding block’.

A coding unit may be divided by at least one line. At this time, theline dividing the coding unit may have a predetermined angle. Here, thepredetermined angle may be a value within a range of 0-degree to360-degree. For example, a 0-degree line may mean a horizontal line, a90-degree line may mean a vertical line, and a 45-degree or 135-degreeline may mean a diagonal line.

When a coding unit is divided by a plurality of lines, all of theplurality of lines may have the same angle. Alternatively, at least oneof the plurality of lines may have an angle different from the otherlines. Alternatively, the plurality of lines dividing a coding tree unitor a coding unit may be set to have a predefined angle difference (e.g.,90-degree).

Information regarding the line dividing a coding tree unit or a codingunit may be defined as a partition mode and be encoded. Alternatively,information on the number of lines, directions, angles, positions oflines in a block, or the like may be encoded.

For convenience of explanation, it is assumed in the embodimentdescribed below that a coding tree unit or a coding unit is divided intoa plurality of coding units using at least one of a vertical line and ahorizontal line.

When it is assumed that partitioning of a coding unit is performed basedon at least one of a vertical line or a horizontal line, the number ofvertical lines or horizontal lines partitioning the coding unit may beone or more. For example, the coding tree unit or the coding unit may bedivided into two partitions using one vertical line or one horizontalline, or the coding unit may be divided into three partitions using twovertical lines or two horizontal lines. Alternatively, the coding unitmay be partitioned into four partitions having a length and a width of ½by using one vertical line and one horizontal line.

When a coding tree unit or a coding unit is divided into a plurality ofpartitions using at least one vertical line or at least one horizontalline, the partitions may have a uniform size. Alternatively, any onepartition may have a different size from the remaining partitions oreach partition may have a different size.

In the embodiments described below, it is assumed that dividing a codingunit into four partitions is a quad-tree based partitioning, and thatdividing a coding unit into two partitions is a binary-tree basedpartitioning. In addition, it is assumed that dividing a coding unitinto three partitions is a triple-tree based partitioning. In addition,it is assumed that a dividing scheme by applying at least two or morepartitioning scheme is a multi-tree based partitioning.

In the following drawings, it will be illustrated that a predeterminednumber of vertical lines or a predetermined number of horizontal linesare used to divide a coding unit, but it will also be within a scope ofthe present invention to divide the coding unit into more partitions orfewer partitions than shown using a greater number of vertical lines ora greater number of horizontal lines than shown.

FIGS. 4A to 4C are diagram illustrating a partition type in which a quadtree and a binary tree partitioning are allowed according to anembodiment of the present invention.

An input video signal is decoded in predetermined block units. Such adefault unit for decoding the input video signal is a coding block. Thecoding block may be a unit performing intra/inter prediction, transform,and quantization. In addition, a prediction mode (e.g., intra predictionmode or inter prediction mode) is determined in units of a coding block,and the prediction blocks included in the coding block may share thedetermined prediction mode. The coding block may be a square ornon-square block having an arbitrary size in a range of 8×8 to 64×64, ormay be a square or non-square block having a size of 128×128, 256×256,or more.

Specifically, the coding block may be hierarchically partitioned basedon at least one of a quad tree and a binary tree. Here, quad tree-basedpartitioning may mean that a 2N×2N coding block is partitioned into fourN×N coding blocks (FIG. 4A), and binary tree-based partitioning may meanthat one coding block is partitioned into two coding blocks. Even if thebinary tree-based partitioning is performed, a square-shaped codingblock may exist in the lower depth.

Binary tree-based partitioning may be symmetrically or asymmetricallyperformed. In addition, the coding block partitioned based on the binarytree may be a square block or a non-square block, such as a rectangularshape. For example, as depicted in FIG. 4B, a partition type in whichthe binary tree-based partitioning is allowed may be a symmetric type of2N×N (horizontal directional non-square coding unit) or N×2N (verticaldirection non-square coding unit). In addition, as one example depictedin FIG. 4C, a partition type in which the binary tree-based partitioningis allowed may be an asymmetric type of nLx2N, nRx2N, 2NxnU, or 2NxnD.

Binary tree-based partitioning may be limitedly allowed to one of asymmetric or an asymmetric type partition. In this case, constructingthe coding tree unit with square blocks may correspond to quad tree CUpartitioning, and constructing the coding tree unit with symmetricnon-square blocks may correspond to binary tree CU partitioning.Constructing the coding tree unit with square blocks and symmetricnon-square blocks may correspond to quad and binary tree CUpartitioning.

Hereinafter, a partitioning scheme based on a quad-tree and abinary-tree is referred to as Quad-Tree & Binary-Tree (QTBT)partitioning.

As a result of partitioning based on quad-tree and binary-tree, a codingblock that is no longer divided may be used as a prediction block or atransform block. That is, in a quad-tree & binary-tree (QTBT)partitioning method, a coding block may become a prediction block, and aprediction block may become a transform block. For example, when theQTBT partitioning method is used, a prediction image may be generated ina unit of a coding block, and a residual signal, which is a differencebetween an original image and the prediction image, is transformed in aunit of a coding block. Here, generating the prediction image in a unitof a coding block may mean that motion information is determined basedon a coding block or an intra prediction mode is determined based on acoding block. Accordingly, a coding block may be encoded using at leastone of a skip mode, intra prediction, or inter prediction.

As another example, it is also possible to divide a coding block so asto use a prediction block or a transform block having a size smallerthan the coding block.

In a QTBT partitioning method, BT may be set to be allowed only forsymmetric partitioning. However, if only the symmetric binary tree isallowed even though an object and a background are divided at a blockboundary, an encoding efficiency may be decreased. In the presentinvention, a method of asymmetric partitioning a coding block in orderto increase an encoding efficiency will be described below as anotherembodiment. Asymmetric binary tree partitioning represents a division ofa coding block into two smaller coding blocks. As a result of theasymmetric binary tree partitioning, a coding block may be divided intotwo coding blocks of an asymmetric shape.

Binary tree-based partitioning may be performed on a coding block wherequad tree-based partitioning is no longer performed. Quad tree-basedpartitioning may no longer be performed on the coding block partitionedbased on the binary tree.

Furthermore, partitioning of a lower depth may be determined dependingon a partition type of an upper depth. For example, if binary tree-basedpartitioning is allowed in two or more depths, only the same type as thebinary tree partitioning of the upper depth may be allowed in the lowerdepth. For example, if the binary tree-based partitioning in the upperdepth is performed with 2N×N type, the binary tree-based partitioning inthe lower depth is also performed with 2N×N type. Alternatively, if thebinary tree-based partitioning in the upper depth is performed with N×2Ntype, the binary tree-based partitioning in the lower depth is alsoperformed with N×2N type.

On the contrary, it is also possible to allow, in a lower depth, only atype different from a binary tree partitioning type of an upper depth.

It may be possible to limit only a specific type of binary tree basedpartitioning to be used for sequence, slice, coding tree unit, or codingunit. As an example, only 2N×N type or N×2N type of binary tree-basedpartitioning may be allowed for the coding tree unit. An availablepartition type may be predefined in an encoder or a decoder. Orinformation on available partition type or on unavailable partition typeon may be encoded and then signaled through a bitstream.

FIG. 5 illustrates an example in which a coding block is hierarchicallydivided based on quad tree partitioning and binary tree partitioning,according to an embodiment to which the present invention is applied.

As shown in FIG. 5, the first coding block 300 with the partition depth(split depth) of k may be partitioned into multiple second coding blocksbased on the quad tree. For example, the second coding blocks 310 to 340may be square blocks having the half width and the half height of thefirst coding block, and the partition depth of the second coding blockmay be increased to k+1.

The second coding block 310 with the partition depth of k+1 may bepartitioned into multiple third coding blocks with the partition depthof k+2. Partitioning of the second coding block 310 may be performed byselectively using one of the quad tree and the binary tree depending ona partitioning method. Here, the partitioning method may be determinedbased on at least one of the information indicating quad tree-basedpartitioning and the information indicating binary tree-basedpartitioning.

When the second coding block 310 is partitioned based on the quad tree,the second coding block 310 may be partitioned into four third codingblocks 310 a having the half width and the half height of the secondcoding block, and the partition depth of the third coding block 310 amay be increased to k+2. In contrast, when the second coding block 310is partitioned based on the binary tree, the second coding block 310 maybe partitioned into two third coding blocks. Here, each of two thirdcoding blocks may be a non-square block having one of the half width andthe half height of the second coding block, and the partition depth maybe increased to k+2. The second coding block may be determined as anon-square block of a horizontal direction or a vertical directiondepending on a partitioning direction, and the partitioning directionmay be determined based on the information on whether binary tree-basedpartitioning is performed in a vertical direction or a horizontaldirection.

In the meantime, the second coding block 310 may be determined as a leafcoding block that is no longer partitioned based on the quad tree or thebinary tree. In this case, the leaf coding block may be used as aprediction block or a transform block.

Like partitioning of the second coding block 310, the third coding block310 a may be determined as a leaf coding block, or may be furtherpartitioned based on the quad tree or the binary tree.

In the meantime, the third coding block 310 b partitioned based on thebinary tree may be further partitioned into coding blocks 310 b-2 of avertical direction or coding blocks 310 b-3 of a horizontal directionbased on the binary tree, and the partition depth of the relevant codingblocks may be increased to k+3. Alternatively, the third coding block310 b may be determined as a leaf coding block 310 b-1 that is no longerpartitioned based on the binary tree. In this case, the coding block 310b-1 may be used as a prediction block or a transform block. However, theabove partitioning process may be limitedly performed based on at leastone of the information on the size/depth of the coding block that quadtree-based partitioning is allowed, the information on the size/depth ofthe coding block that binary tree-based partitioning is allowed, and theinformation on the size/depth of the coding block that binary tree-basedpartitioning is not allowed.

A number of a candidate that represent a size of a coding block may belimited to a predetermined number, or a size of a coding block in apredetermined unit may have a fixed value. As an example, the size ofthe coding block in a sequence or in a picture may be limited to have256×256, 128×128, or 32×32. Information indicating the size of thecoding block in the sequence or in the picture may be signaled through asequence header or a picture header.

As a result of partitioning based on a quad tree and a binary tree, acoding unit may be represented as square or rectangular shape of anarbitrary size.

FIGS. 6A to 6C illustrates an example in which a coding block ishierarchically divided based on quad tree partitioning and symmetricbinary tree partitioning, according to an embodiment to which thepresent invention is applied.

FIGS. 6A to 6C illustrates an example in which only a specific type, forexample a symmetric binary tree based partitioning, is allowed. FIG. 6Ashows an example in which only binary tree based partitioning in a typeof N×2N is limitedly allowed. For example, a depth 1 coding block 601 isdivided into two N×2N blocks 601 a and 601 b in depth 2, and a depth 2coding block 602 is divisible into two N×2N blocks 602 a and 602 b indepth 3.

FIG. 6B shows an example in which only binary tree based partitioning ofa 2N×N type is limitedly allowed. For example, a depth 1 coding block603 is divided into two 2N×N blocks 603 a and 603 b in depth 2, and adepth 2 coding block 604 is divisible into two 2N×N blocks 604 a and 604b in depth 3.

FIG. 6C shows an example of partitioning a block which is generated by asymmetric binary tree partitioning. For example, a depth 1 coding block605 is divided into two N×2N blocks 605 a and 605 b in depth 2, and thedepth 2 coding block 605 a generated as a result of the division isdivided into two N×2N blocks 605 a 1 and 605 a 2. The above describeddivisional manner is also applicable to a 2N×N coding block which isgenerated by symmetric binary tree partitioning.

In order to implement quad-tree or binary tree based adaptivepartitioning, information indicating quad-tree based partitioning,information on a size/depth of a coding block to which quad-tree basedpartitioning is allowed, information indicating binary-tree basedpartitioning, information about a size/depth of a coding block to whichbinary-tree based partitioning is allowed, information on a size/depthof a coding block to which binary-tree based partitioning is disallowed,information whether binary-tree based partitioning is performed in avertical direction or a horizontal direction, or the like may be used.For example, quad_split_flag may indicate whether a coding block isdivided into four coding blocks, and binary_split_flag may indicatewhether a coding block is divided into two coding blocks. When a codingblock is divided into two coding blocks, is_hor_split_flag indicatingwhether a partitioning direction of the coding block is a verticaldirection or a horizontal direction may be signaled.

Also, for a coding tree unit or a predetermined coding unit, the numberof times for which binary tree partitioning is allowed, a depth at whichbinary tree partitioning is allowed, or the number of the depths towhich the binary tree partitioning is allowed may be obtained. Theinformation may be encoded in a unit of a coding tree unit or a codingunit, and may be transmitted to the decoder through a bitstream.

For example, a syntax ‘max_binary_depth_idx_minus1’ indicating a maximumdepth at which binary tree partitioning is allowed may beencoded/decoded through the bitstream. In this case,max_binary_depth_idx_minus1+1 may indicate a maximum depth at whichbinary tree partitioning is allowed.

In addition, in the example of FIG. 6C described above, it isillustrated a result of binary tree partitioning relating to depth 2coding units (e.g., 605 a and 605 b) and depth 3 coding units (e.g., 605a 1 and 605 a 2). Thus, at least one of information indicating thenumber of times (e.g., twice) for which binary tree partitioning hasbeen performed in the coding tree unit, information indicating a maximumdepth (e.g., depth 3) at which binary tree partitioning is allowed inthe coding tree unit, or information indicating the number of depths(e.g., 2, depth 2 and depth 3) to which binary tree partitioning isallowed may be encoded/decoded through the bitstream.

As another example, at least one of the number of times for which binarytree partitioning is allowed, a depth at which binary tree partitioningis allowed, or the number of depths to which binary tree partitioning isallowed may be obtained for each sequence or slice. For example, theinformation may be encoded in a unit of a sequence, a picture, or aslice and transmitted through the bitstream. Accordingly, a first sliceand a second slice may differ in at least one of the number of times forwhich binary tree partitioning is performed, a maximum depth at whichbinary tree partitioning is allowed, or the number of depths to whichbinary tree partitioning is allowed. For example, in the first slice,binary tree partitioning is allowed at only one depth, while in thesecond slice, binary tree partitioning is allowed at two depths.

As another example, at least one of the number of times for which binarytree partitioning is allowed, a depth at which binary tree partitioningis allowed, or the number of depths to which binary tree partitioning isallowed may be set differently according to a time level identifier(Temporal_ID) of a slice or a picture. Here, the temporal levelidentifier (Temporal_ID) is used to identify each of a plurality oflayers of a video having a scalability of at least one of view, spatial,temporal or image quality.

It is also possible to restrict use of a transform skip for a CU whichis partitioned by binary partitioning. Alternatively, a transform skipmay be applied only in at least one of a horizontal direction or avertical direction for a CU which is partitioned by non-squarepartitioning. Applying a transform skip only in a horizontal directionmay mean that only a scaling and a quantization are performed in ahorizontal direction without performing a transform in the horizontaldirection, and a transform is performed in a vertical direction byspecifying at least one transform scheme such as DCT or DST.

Likewise, applying a transform skip only in a vertical direction maymean that a transform is performed in a horizontal direction byspecifying at least one transform scheme such as DCT or DST, and only ascaling and a quantization are performed in a vertical direction withoutperforming a transform in the vertical direction. It is also possible tosignal a syntax hor_transform_skip_flag indicating whether to apply atransform skip in a horizontal direction and a syntaxver_transform_skip_flag indicating whether to apply a transform skip ina vertical direction.

When a transform skip is applied to at least one of a horizontaldirection or a vertical direction, information indicating a direction towhich the transform skip is applied may be signaled according to a shapeof a CU. Specifically, for example, for a CU of 2N×N shape, a transformis performed in a horizontal direction and a transform skip can beapplied on a vertical direction, and, for a CU of N×2N shape, atransform skip can be applied in a horizontal direction and a transformis performed on a vertical direction. Here, the transform may be atleast one of DCT or DST.

As another example, for a CU of 2N×N shape, a transform is performed ina vertical direction and a transform skip can be applied in a horizontaldirection, and, for a CU of N×2N shape, a transform skip can be appliedin a vertical direction and a transform is performed in a horizontaldirection. Here, the transform may be at least one of DCT or DST.

FIGS. 7A to 7I are diagram illustrating a partition type in whichmulti-tree partitioning is allowed according to another embodiment ofthe present invention.

A method of partitioning a CTU or CU using at least one of theabove-described quad tree partitioning, binary partitioning, or tripletree partitioning may be referred to multi-tree partitioning (or multitree CU partitioning). A CTU or CU can be partitioned using any Npartitions among the above mentioned examples. Specifically, forexample, as shown in FIGS. 7A to 7I, a CTU or CU may be partitionedusing 9 partitioning types.

For a unit of a sequence or a picture, partitioning may be performed byusing all of quad tree partitioning, binary tree partitioning, andtriple tree partitioning or partitioning may be performed by using oneor two of quad tree partitioning, binary tree partitioning, or tripletree partitioning.

It is also possible to use quad tree partitioning as default, and to usebinary tree partitioning and triple tree partitioning selectively. Atthis time, it is possible to signal whether to use binary treepartitioning and/or triple tree partitioning through a sequenceparameter set or picture parameter set.

Alternatively, it is also possible to use quad tree partitioning andtriple tree partitioning as default, and to use binary tree partitioningselectively. For example, a syntax isUseBinaryTreeFlag indicatingwhether binary tree partition is used may be signaled in a sequenceheader. If a value of the isUseBinaryTreeFlag is 1, a CTU or CU in thecurrent sequence can be partitioned using binary tree partitioning. Itis also possible to signal a syntax isUseTripleTreeFlag indicatingwhether triple tree partitioning is used through a sequence header. If avalue of the isUseTripleTreeFlag is 1, a CTU or CU in the currentsequence header may be partitioned using triple tree partitioning.

Partition shapes partitioned by multi-tree partitioning can be limitedto 9 basic partitions shown in, for example, FIG. 7A to 7I. FIG. 7Ashows a quad partition type, 7B to 7C show symmetric binary treepartition types, 7D to 7E show triple tree partition types and 7F to 7Ishow asymmetric binary tree partition types. The detailed descriptionrelating to each partition type illustrated in FIGS. 7A to 7I areomitted since they are identical to above described.

FIG. 8 is a diagram illustrating types of pre-defined intra predictionmodes for a device for encoding/decoding a video according to anembodiment of the present invention.

The device for encoding/decoding a video may perform intra predictionusing one of pre-defined intra prediction modes. The pre-defined intraprediction modes for intra prediction may include non-directionalprediction modes (e.g., a planar mode, a DC mode) and 33 directionalprediction modes.

Alternatively, in order to enhance accuracy of intra prediction, alarger number of directional prediction modes than the 33 directionalprediction modes may be used. That is, M extended directional predictionmodes may be defined by subdividing angles of the directional predictionmodes (M>33), and a directional prediction mode having a predeterminedangle may be derived using at least one of the 33 pre-defineddirectional prediction modes.

A larger number of intra prediction modes than 35 intra prediction modesshown in FIG. 8 may be used. For example, a larger number of intraprediction modes than the 35 intra prediction modes can be used bysubdividing angles of directional prediction modes or by deriving adirectional prediction mode having a predetermined angle using at leastone of a pre-defined number of directional prediction modes. At thistime, the use of a larger number of intra prediction modes than the 35intra prediction modes may be referred to as an extended intraprediction mode.

FIG. 9 shows an example of extended intra prediction modes, and theextended intra prediction modes may include two non-directionalprediction modes and 65 extended directional prediction modes. The samenumbers of the extended intra prediction modes may be used for a lumacomponent and a chroma component, or a different number of intraprediction modes may be used for each component. For example, 67extended intra prediction modes may be used for the luma component, and35 intra prediction modes may be used for the chroma component.

Alternatively, depending on the chroma format, a different number ofintra prediction modes may be used in performing intra prediction. Forexample, in the case of the 4:2:0 format, 67 intra prediction modes maybe used for the luma component to perform intra prediction and 35 intraprediction modes may be used for the chroma component. In the case ofthe 4:4:4 format, 67 intra prediction modes may be used for both theluma component and the chroma component to perform intra prediction.

Alternatively, depending on the size and/or shape of the block, adifferent number of intra prediction modes may be used to perform intraprediction. That is, depending on the size and/or shape of the PU or CU,35 intra prediction modes or 67 intra prediction modes may be used toperform intra prediction. For example, when the CU or PU has the sizeless than 64×64 or is asymmetrically partitioned, 35 intra predictionmodes may be used to perform intra prediction. When the size of the CUor PU is equal to or greater than 64×64, 67 intra prediction modes maybe used to perform intra prediction. 65 directional intra predictionmodes may be allowed for Intra 2N×2N, and only 35 directional intraprediction modes may be allowed for Intra N×N.

A size of a block to which the extended intra prediction mode is appliedmay be set differently for each sequence, picture or slice. For example,it is set that the extended intra prediction mode is applied to a block(e.g., CU or PU) which has a size greater than 64×64 in the first slice.On the other hands, it is set that the extended intra prediction mode isapplied to a block which has a size greater than 32×32 in the secondslice. Information representing a size of a block to which the extendedintra prediction mode is applied may be signaled through in units of asequence, a picture, or a slice. For example, the information indicatingthe size of the block to which the extended intra prediction mode isapplied may be defined as ‘log 2 extended intra mode size minus4’obtained by taking a logarithm of the block size and then subtractingthe integer 4. For example, if a value of log 2 extended intra mode sizeminus4 is 0, it may indicate that the extended intra prediction mode maybe applied to a block having a size equal to or greater than 16×16. Andif a value of log 2 extended intra mode size minus4 is 1, it mayindicate that the extended intra prediction mode may be applied to ablock having a size equal to or greater than 32×32.

As described above, the number of intra prediction modes may bedetermined in consideration of at least one of a color component, achroma format, and a size or a shape of a block. In addition, the numberof intra prediction mode candidates (e.g., the number of MPMs) used fordetermining an intra prediction mode of a current block to beencoded/decoded may also be determined according to at least one of acolor component, a color format, and the size or a shape of a block. Amethod of determining an intra prediction mode of a current block to beencoded/decoded and a method of performing intra prediction using thedetermined intra prediction mode will be described with the drawings.

FIG. 10 is a flowchart briefly illustrating an intra prediction methodaccording to an embodiment of the present invention.

Referring to FIG. 10, an intra prediction mode of the current block maybe determined at step S1000.

Specifically, the intra prediction mode of the current block may bederived based on a candidate list and an index. Here, the candidate listcontains multiple candidates, and the multiple candidates may bedetermined based on an intra prediction mode of the neighboring blockadjacent to the current block. The neighboring block may include atleast one of blocks positioned at the top, the bottom, the left, theright, and the corner of the current block. The index may specify one ofthe multiple candidates of the candidate list. The candidate specifiedby the index may be set to the intra prediction mode of the currentblock.

An intra prediction mode used for intra prediction in the neighboringblock may be set as a candidate. Also, an intra prediction mode havingdirectionality similar to that of the intra prediction mode of theneighboring block may be set as a candidate. Here, the intra predictionmode having similar directionality may be determined by adding orsubtracting a predetermined constant value to or from the intraprediction mode of the neighboring block. The predetermined constantvalue may be an integer, such as one, two, or more.

The candidate list may further include a default mode. The default modemay include at least one of a planar mode, a DC mode, a vertical mode,and a horizontal mode. The default mode may be adaptively addedconsidering the maximum number of candidates that can be included in thecandidate list of the current block.

The maximum number of candidates that can be included in the candidatelist may be three, four, five, six, or more. The maximum number ofcandidates that can be included in the candidate list may be a fixedvalue preset in the device for encoding/decoding a video, or may bevariably determined based on a characteristic of the current block. Thecharacteristic may mean the location/size/shape of the block, thenumber/type of intra prediction modes that the block can use, a colortype, a color format, etc.

Alternatively, information indicating the maximum number of candidatesthat can be included in the candidate list may be signaled separately,and the maximum number of candidates that can be included in thecandidate list may be variably determined using the information. Theinformation indicating the maximum number of candidates may be signaledin at least one of a sequence level, a picture level, a slice level, anda block level.

When the extended intra prediction modes and the 35 pre-defined intraprediction modes are selectively used, the intra prediction modes of theneighboring blocks may be transformed into indexes corresponding to theextended intra prediction modes, or into indexes corresponding to the 35intra prediction modes, whereby candidates can be derived. For transformto an index, a pre-defined table may be used, or a scaling operationbased on a predetermined value may be used. Here, the pre-defined tablemay define a mapping relation between different intra prediction modegroups (e.g., extended intra prediction modes and 35 intra predictionmodes).

For example, when the left neighboring block uses the 35 intraprediction modes and the intra prediction mode of the left neighboringblock is 10 (a horizontal mode), it may be transformed into an index of16 corresponding to a horizontal mode in the extended intra predictionmodes.

Alternatively, when the top neighboring block uses the extended intraprediction modes and the intra prediction mode the top neighboring blockhas an index of 50 (a vertical mode), it may be transformed into anindex of 26 corresponding to a vertical mode in the 35 intra predictionmodes.

Based on the above-described method of determining the intra predictionmode, the intra prediction mode may be derived independently for each ofthe luma component and the chroma component, or the intra predictionmode of the chroma component may be derived depending on the intraprediction mode of the luma component.

Specifically, the intra prediction mode of the chroma component may bedetermined based on the intra prediction mode of the luma component asshown in the following Table 1.

TABLE 1 Intra_chroma_pred_mode IntraPredModeY[xCb][yCb] [xCb][yCb] 0 2610 1 X(0 <= X <= 34) 0 34 0 0 0 0 1 26 34 26 26 26 2 10 10 34 10 10 3 11 1 34 1 4 0 26 10 1 X

In Table 1, intra chroma pred mode means information signaled to specifythe intra prediction mode of the chroma component, and IntraPredModeYindicates the intra prediction mode of the luma component. Referring toFIG. 10, a reference sample for intra prediction of the current blockmay be derived at step S1010. Specifically, a reference sample for intraprediction may be derived based on a neighboring sample of the currentblock. The neighboring sample may be a reconstructed sample of theneighboring block, and the reconstructed sample may be a reconstructedsample before an in-loop filter is applied or a reconstructed sampleafter the in-loop filter is applied.

A neighboring sample reconstructed before the current block may be usedas the reference sample, and a neighboring sample filtered based on apredetermined intra filter may be used as the reference sample.Filtering of neighboring samples using an intra filter may also bereferred to as reference sample smoothing. The intra filter may includeat least one of the first intra filter applied to multiple neighboringsamples positioned on the same horizontal line and the second intrafilter applied to multiple neighboring samples positioned on the samevertical line. Depending on the positions of the neighboring samples,one of the first intra filter and the second intra filter may beselectively applied, or both intra filters may be applied. At this time,at least one filter coefficient of the first intra filter or the secondintra filter may be (1, 2, 1), but is not limited thereto.

Filtering may be adaptively performed based on at least one of the intraprediction mode of the current block and the size of the transform blockfor the current block. For example, when the intra prediction mode ofthe current block is the DC mode, the vertical mode, or the horizontalmode, filtering may not be performed. When the size of the transformblock is N×M, filtering may not be performed. Here, N and M may be thesame values or different values, or may be values of 4, 8, 16, or more.For example, if the size of the transform block is 4×4, filtering maynot be performed. Alternatively, filtering may be selectively performedbased on the result of a comparison of a pre-defined threshold and thedifference between the intra prediction mode of the current block andthe vertical mode (or the horizontal mode). For example, when thedifference between the intra prediction mode of the current block andthe vertical mode is greater than a threshold, filtering may beperformed. The threshold may be defined for each size of the transformblock as shown in Table 2.

TABLE 2 8 × 8 transform 16 × 16 transform 32 × 32 transform Threshold 71 0

The intra filter may be determined as one of multiple intra filtercandidates pre-defined in the device for encoding/decoding a video. Tothis end, an index specifying an intra filter of the current block amongthe multiple intra filter candidates may be signaled.

Alternatively, the intra filter may be determined based on at least oneof the size/shape of the current block, the size/shape of the transformblock, information on the filter strength, and variations of theneighboring samples. Referring to FIG. 10, intra prediction may beperformed using the intra prediction mode of the current block and thereference sample at step S1020.

That is, the prediction sample of the current block may be obtainedusing the intra prediction mode determined at step S1000 and thereference sample derived at step S1010.

Hereinafter, with reference to FIG. 11 and FIG. 12, intra predictionusing a sample position based parameter according to the presentinvention will be described.

In the case of intra prediction, a prediction sample is generated usingneighboring samples of a current block to be encoded or decoded.Therefore, when a sample value located far from a neighboring sample ispredicted, a problem that a difference between the predicted value andan original sample value becomes larger may occur. In addition, a size,shape, and/or intra prediction mode of the current block may cause anoccurrence and spread of such the problem.

Therefore, after obtaining a prediction block of the current block usinga certain intra prediction mode, a prediction block that is more similarto an original block can be obtained by modifying all or a part ofprediction samples in the prediction block based on informationavailable by the encoder 100 or the decoder 200.

Intra prediction according to the present embodiment generates a firstprediction block by performing intra prediction and then generate asecond prediction block by performing a weighted prediction on the firstprediction block based on a specific parameter. Here, since the specificparameter can be determined depending on a position of a sample in thefirst prediction block, hereinafter this will be referred to as a sampleposition based parameter.

FIG. 11 is a flowchart illustrating an intra prediction method using asample position based parameter according to an embodiment to which thepresent invention is applied. The intra prediction method shown in FIG.11 may be performed substantially by the intra prediction unit 125 ofthe image encoding apparatus 100 and the intra prediction unit 235 ofthe image decoding apparatus 200. In addition, steps shown in FIG. 11relate to performing intra prediction S1020 in FIG. 10. Therefore, priorto steps shown in FIG. 11, determining an intra prediction mode S1000and deriving reference samples S1010 of FIG. 10 may be performed.

Referring to FIG. 11, a prediction block of a current block may begenerated by performing intra prediction S1100. At this time, the intraprediction method or the prediction mode may be the intra predictionmethod or mode described with reference to FIG. 8 or FIG. 9. However, itis not limited thereto.

Based on a position of a first prediction sample in a prediction blockof a current block, at least one sample position based parameter may bederived S1110. If intra prediction using the sample position basedparameter according to the present invention is performed under aspecific condition, determining whether the specific condition issatisfied may be performed before the execution of step S1110. Forexample, at least one of a size of a block, a shape of a block, an intraprediction mode of a block, whether a directional intra prediction modeis used, or a syntax element or a parameter indicating whether intraprediction using a sample position based parameter is allowed may beconsidered as the specific condition.

Specifically, depending on whether a size (e.g., width or height) of acurrent coding block or a current prediction block to be intra-predictedis greater than a predetermined size or smaller than a predeterminedsize, it may be determined whether or not to perform intra predictionusing a sample position based parameter.

Alternatively, depending on an intra prediction mode to be applied to acurrent prediction block, it may be determined whether to perform intraprediction using a sample position based parameter. According to anembodiment of the present invention, when an intra prediction mode of acurrent block is planar mode, intra prediction using a sample positionbased parameter according to the present invention may be performed.According to another embodiment of the present invention, when an intraprediction mode of a current block is a non-directional prediction mode,intra prediction using a sample position based parameter according tothe present invention may be performed.

Alternatively, when a syntax element indicating whether intra predictionusing a sample position based parameter is allowed is included in thebitstream generated by the image encoding apparatus 100, it may bedetermined whether to perform intra prediction using a sample positionbased parameter based on a value of the syntax element.

Alternatively, when an internal parameter or a variable indicatingwhether intra prediction using a sample position based parameter isallowed is derived in consideration of one or more conditions such as asize, a shape, and/or an intra prediction mode of a block, it may bedetermined whether to perform intra prediction using a sample positionbased parameter according to a value of the internal parameter or avalue of the variable.

Meanwhile, a sample position based parameter is a parameter used when aprediction sample in a prediction block is modified to a new samplevalue using weighted prediction, as in step S1120.

A sample position based parameter may be derived in consideration of adistance between a reference sample of a predetermined position(hereinafter referred to as a base reference sample) among referencesamples of a prediction block and a reference sample (hereinafterreferred to as a corresponding reference sample) corresponding to acurrent sample, and/or a size of a block and/or a shape of a block.

A size of a block may be represented by at least one of a width or aheight of the block, a sum of the width and the height, the number ofsamples included in the block, or the like. The above-described sampleposition based parameter may be derived through a result of comparisonbetween a size of a block and a predetermined threshold value.

A shape of a block may indicate whether it is a square shape, whether itis a symmetric partition, or whether it is a rectangle of which longerside is in a horizontal direction or in a vertical direction.

FIG. 12 illustrates a base reference sample and a correspondingreference sample according to an embodiment of the present invention.FIG. 12 shows neighboring samples R (p, q) (p and q being integer from−1 to 2N−1) which can be used for intra prediction of a current blockCUO and a current block CUO of N×N size to be encoded or decoded throughintra prediction.

A vertical corresponding reference sample R(x, −1) and a horizontalcorresponding reference sample R(−1, y) are shown as correspondingreference samples of a sample C(x, y) in the current block CUO. That is,the corresponding reference sample may be a reference sample locating onthe same x-axis position or a reference sample locating on the samey-axis position as the sample C(x, y) in the current block among aplurality of reference samples. The number of corresponding referencesamples may be one, two, or more. The number of corresponding referencesamples may be variably determined based on a value of an intraprediction mode of a prediction block, a directionality or an angle, awidth and/or height of a block, or the like. In addition, if a positionof a reference sample is able to be specified by a position of a sampleC(x, y), the reference sample may be used as a corresponding referencesample even though it is not located on the same x-axis or the samey-axis as the sample C(x, y) in the current block.

According to the embodiment shown in FIG. 12, R(−1, −1) may be set as abase reference sample. Of course, it is not limited to this, and a basereference sample may be a sample located at a center, a sample locatedat the leftmost position, a sample located at the rightmost position, ora sample adjacent thereto among a plurality of reference samples locatedat a top of a prediction block.

Alternatively, a base reference sample may be a sample located at acenter, a sample located at the uppermost position, a sample located atthe lowermost position, or a sample adjacent thereto among a pluralityof reference samples located on a left of a prediction block.

There is no need to restrict the number of base reference samples toone, and the number may be two or more. The number of base referencesamples may be variably determined based on a value of an intraprediction mode of a prediction block, a directionality or angle, awidth and/or height of a block, or the like.

A base reference sample and a corresponding reference sample may beincluded in a single sample line (row, column) in contact with aprediction block.

Alternatively, at least one of the base reference sample and thecorresponding reference sample may be included in a sample line not incontact with the prediction block.

In addition, the base and/or corresponding reference samples (e.g., acorresponding reference sample in a vertical direction and/or acorresponding reference sample in a horizontal direction) may befiltered reference samples or unfiltered reference samples

The following Equations 1 and 2 show examples of sample position basedparameters f(x, y) and b(x, y).

$\begin{matrix}{{f\left( {x,y} \right)} = \left\lbrack {{\left( {C_{0} ⪢ \frac{y}{d_{y}}} \right) \times {R\left( {x,{- 1}} \right)}} - {\left( {C_{I} ⪢ \frac{y}{d_{y}}} \right) \times {R\left( {{- 1},{- 1}} \right)}} + {{+ \left( {C_{2} ⪢ \frac{x}{d_{x}}} \right)} \times {R\left( {{- 1},y} \right)}} - {\left( {C_{3} ⪢ \frac{x}{d_{x}}} \right) \times {R\left( {{- 1},{- 1}} \right)}}} \right.} & \left\lbrack {{Equation}\mspace{14mu} 1} \right\rbrack \\{{b\left( {x,y} \right)} = \left( {N - \left( {C_{0} ⪢ \frac{y}{d_{y}}} \right) + \left( {C_{1} ⪢ \frac{y}{d_{y}}} \right) - \left( {C_{2} ⪢ \frac{x}{d_{x}}} \right) + \left( {C_{3} ⪢ \frac{x}{d_{x}}} \right)} \right.} & \left\lbrack {{Equation}\mspace{14mu} 2} \right\rbrack\end{matrix}$

In the above Equations 1 and 2, x and y represent positions on x-axisand y-axis of a sample C(x, y) in a current block. R(−1, −1), R(x, −1)and R(−1, y) represent a value of a base reference sample, a value of acorresponding reference sample in a vertical direction and a value of acorresponding reference sample in a horizontal direction, respectively.C₀, C₁, C₂, and C₃ may be pre-determined constant values and may bepre-stored in the image encoding apparatus 100 or the image decodingapparatus 200. Also, N is a value indicating a weighted predictionoffset.

Parameters dx and dy may be determined according to a size of a currentblock (e.g., a width or height of a block). For example, if a width of ablock is greater than a predefined threshold value, then a value of dxmay be set to 2 and if a width of a block is less than or equal to thepredetermined threshold value, a value of dx may be set to 1. Similarly,when a height of a block is greater than a predefined threshold value, avalue of dy may be set to 2, and if a height of a block is equal to orsmaller than the predefined threshold value, a value of dy may be setto 1. According to an embodiment of the present invention, thepredetermined threshold may be 8, 16, or 32, but is not limited thereto.

Referring back to FIG. 11, a second prediction sample may be generatedby performing a weighted prediction for the first prediction samplebased on at least one sample position based parameter derived in stepS1110 S1120.

Equation 3 below represents an example in which deriving a secondprediction sample P(x, y) by performing weighted prediction for a firstprediction sample q(x, y) based on a sample position based parameter(e.g., f(x, y), b(x, y)).

P(x,y)=[f(x,y)+b(x,y)·q(x,y)+(N>>1)]>>log₂ N  [Equation 3]

In Equation 3, q (x, y) is a value of an intra predicted sample C(x, y)shown in FIG. 12. q(x, y) corresponds to the value of the intrapredicted sample C (x, y) shown in FIG. 12 obtained in step S1100.

Equations 1 to 3 show that a value of a second prediction sample P(x, y)is derived by weighted prediction of a value of a base reference sample,a value of a corresponding reference sample in a vertical direction, avalue of a corresponding reference sample in a horizontal direction, anda first prediction sample q(x, y).

Equation 3 shows that after calculating a weighted predicted value f(x,y)+b(x, y)×q(x, y), a value of a second prediction sample P(x, y) isderived by scaling it using a weighted prediction shift parameter log₂Nand a weighted prediction offset N. In Equation 3, a value of theweighted prediction offset N may be set to 32.

Equation 4 below represents an another embodiment of deriving a value ofa second prediction sample P(x, y) by performing weighted prediction fora first prediction sample q(x, y) based on a sample position basedparameter (e.g., f(x, y), b(x, y)).

P(x,y)=[f(x,y)+b(x,y)*q(x,y)+offset]>>shift

b(x,y)=(1<<shift)−f(x,y)  [Equation 4]

In Equation 4, a parameter shift and a parameter offset indicate aweighted prediction shift parameter and a weighted prediction offset,respectively. Similarly to Equation 3, Equation 4 shows that aftercalculating a weighted predicted value f(x, y)+b(x, y)*q(x, y), a valueof second prediction sample P(x, y) is derived by scaling it using aweighted prediction shift parameter shift and a weighted predictionoffset parameter offset.

Meanwhile, in Equation 3, it is exemplified that a fixed value is usedfor the weighted prediction shift parameter and the weighted predictionoffset. However, the weighted prediction shift parameter shift and theweighted prediction offset parameter offset according to the presentembodiment may be derived according to a width value of a block or aheight value of a block as shown in Equation 5.

offset=(log 2 width+log 2height)>>1

shift=log 2 width+log 2 height  [Equation 5]

According to an embodiment of the present invention, when a currentblock is a non-square block obtained by binary tree partitioning ormulti-tree partitioning, a weighted prediction shift parameter shift anda weighted prediction offset parameter offset may be derived based on awidth or height of the current block as shown in Equation 5.

Meanwhile, as shown in Equations 3 or 4, there does not have to use allof parameters f(x, y), b(x, y), offset and shift which are used toderive a second prediction sample, in some cases some parameters may notbe used.

Although an intra prediction method using a sample position basedparameter according to the embodiment of the present invention shown inFIG. 11 has been described for the case of modifying one sample value inthe prediction block, but the method can be applied to all samples inthe prediction block or samples in a partial region in the predictionblock. The partial region may be one row/column or a plurality ofrows/columns, and it may be a predetermined area by the image encodingapparatus 100 or the image decoding apparatus 200. For example,modification may be performed on one row/column located at a boundary ofthe prediction block or a plurality of rows/columns from the boundary ofthe prediction block.

Alternatively, the partial region may be a sub-block in a predictionblock, not a row or a column.

Alternatively, the partial region may be variably determined based on atleast one of a size/shape of a prediction block or an intra predictionmode.

Meanwhile, according to the embodiment of the present invention shown inFIG. 11, step S1100 is performed before step S1110, but step S1110 maybe executed before step S1100, or both of them may be performed inparallel. However, step S1120 is executed after performing steps S1100and S1110.

Although the above-described embodiments have been described on thebasis of a series of steps or flowcharts, they do not limit thetime-series order of the invention, and may be performed simultaneouslyor in different orders as necessary. Further, each of the components(for example, units, modules, etc.) constituting the block diagram inthe above-described embodiments may be implemented by a hardware deviceor software, and a plurality of components. Or a plurality of componentsmay be combined and implemented by a single hardware device or software.The above-described embodiments may be implemented in the form ofprogram instructions that may be executed through various computercomponents and recorded in a computer-readable recording medium. Thecomputer-readable recording medium may include one of or combination ofprogram commands, data files, data structures, and the like. Examples ofcomputer-readable media include magnetic media such as hard disks,floppy disks and magnetic tape, optical recording media such as CD-ROMsand DVDs, magneto-optical media such as floptical disks, media, andhardware devices specifically configured to store and execute programinstructions such as ROM, RAM, flash memory, and the like. The hardwaredevice may be configured to operate as one or more software modules forperforming the process according to the present invention, and viceversa.

INDUSTRIAL APPLICABILITY

The present invention may be applied to electronic devices which is ableto encode/decode a video.

1-8. (canceled)
 9. A method of decoding a video, the method comprising:generating a prediction sample of a current block based on an intraprediction mode of the current block; determining whether to modify theprediction sample or not; when it is determined to modify the predictionsample, deriving a first sample position based parameter for modifyingthe prediction sample in the current block; obtaining a modifiedprediction sample based on the prediction sample and the first sampleposition based parameter; obtaining a residual sample of the currentblock; and obtaining a reconstruction sample based on the modifiedprediction sample and the residual sample, wherein the first sampleposition based parameter being derived based on a multiplication of areference sample adjacent to the current block and a first weight,wherein the first weight is derived by shifting a constant value basedon a value derived based on a coordinate of the prediction sample and ashift parameter, wherein the shift parameter is derived based on a widthand a height of the current block, and wherein the shift parameter isderived based on a sum of log₂ width and log₂ height.
 10. The method ofclaim 9, wherein obtaining the modified prediction sample is derived byadding the first sample position based parameter to a weightedprediction sample, wherein the weight prediction sample is derived basedon a multiplication of a second weight and the prediction sample. 11.The method of claim 10, wherein the second weight is derived based on asubtraction the first weight from a constant value.
 12. The method ofclaim 9, wherein a determination of whether to modify the predictionsample is based on at least one of a size of the current block, and theintra prediction mode of the current block.
 13. A method of encoding avideo, the method comprising: generating a prediction sample of acurrent block based on an intra prediction mode of the current block;determining whether to modify the prediction sample or not; when it isdetermined to modify the prediction sample, deriving a first sampleposition based parameter for modifying the prediction sample in theprediction block; obtaining a modified prediction sample based on theprediction sample and the first sample position based parameter;obtaining a residual sample of the current block; and obtaining areconstruction sample based on the modified prediction sample and theresidual sample, wherein the first sample position based parameter beingderived based on a multiplication of a reference sample adjacent to thecurrent block and a first weight, wherein the first weight is derived byshifting a constant value based on a value derived based on a coordinateof the prediction sample and a shift parameter, wherein the shiftparameter is derived based on a width and a height of the current block,and wherein the shift parameter is derived based on a sum of log₂ widthand log₂ height.
 14. The method of claim 13, wherein obtaining themodified prediction sample is derived by adding the first sampleposition based parameter to a weighted prediction sample, wherein theweight prediction sample is derived based on a multiplication of asecond weight and the prediction sample.
 15. The method of claim 14,wherein the second weight is derived based on a subtraction the firstweight from a constant value.
 16. The method of claim 13, wherein adetermination of whether to modify the prediction sample is based on atleast one of a size of the current block, and the intra prediction modeof the current block.
 17. A non-transitory computer readable recodingmedium comprising a video signal bitstream, the video signal bitstreamincluded in the recoding medium is encoded by a video encoding methodcomprising: generating a prediction sample of a current block based onan intra prediction mode of the current block; determining whether tomodify the prediction sample or not; when it is determined to modify theprediction sample, deriving a first sample position based parameter formodifying the prediction sample in the prediction block; obtaining amodified prediction sample based on the prediction sample and the firstsample position based parameter; obtaining a residual sample of thecurrent block; and obtaining a reconstruction sample based on themodified prediction sample and the residual sample, wherein the firstsample position based parameter being derived based on a multiplicationof a reference sample adjacent to the current block and a first weight,wherein the first weight is derived by shifting a constant value basedon a value derived based on a coordinate of the prediction sample and ashift parameter, wherein the shift parameter is derived based on a widthand a height of the current block, and wherein the shift parameter isderived based on a sum of log₂ width and log₂ height.